<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('遗失报废')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" style="padding-left: 90px">
    <form class="form-horizontal" id="form">
        <div class="form-group">
            <label class="col-sm-3 control-label">资产序号：</label>
            <div class="col-sm-8">
                <span th:text="${assetId}"></span>—<input name="txt_remark" required id="no" min="1" th:max="${amount}" type="number"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">处理类型：</label>
            <div class="col-sm-8">
                <label class="radio-box"> <input type="radio" checked name="lostScrapStatus" value="1" required/> 遗失 </label>
                <label class="radio-box"> <input type="radio" name="lostScrapStatus" value="2" required/> 报废 </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="txt_remark" id="remark" class="text-area" style="width:200px;height:100px;"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var sUserAgent = navigator.userAgent.toLowerCase();
    var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad';
    var bIsIphone = sUserAgent.match(/iphone os/i) == 'iphone os';
    var bIsMidp = sUserAgent.match(/midp/i) == 'midp';
    var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4';
    var bIsUc = sUserAgent.match(/ucweb/i) == 'web';
    var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce';
    var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile';
    var bIsAndroid = sUserAgent.match(/android/i) == 'android';

    $("#form").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var assetId = [[${assetId}]];
            var status=$('input:radio:checked').val();
            var remark=$('#remark').val();
            var no=$('#no').val();
            if(status==1){
                $.modal.confirm("确定遗失处理？", function () {
                    $.operate.save(ctx + "inventory/scrap/lost", {
                        inventoryNo: assetId+"-"+no,
                        assetId: assetId,
                        remark: remark
                    });
                });
            }else {
                $.modal.confirm("确定报废处理？", function () {
                    $.operate.save(ctx + "inventory/scrap/scrap", {
                        inventoryNo: assetId+"-"+no,
                        assetId: assetId,
                        remark: remark
                    });
                });
            }
        }
    }
</script>
</body>
</html>